Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add App Clip to Demo project #659

Open
wants to merge 19 commits into
base: trunk
Choose a base branch
from
Open

Add App Clip to Demo project #659

wants to merge 19 commits into from

Conversation

mokagio
Copy link
Contributor

@mokagio mokagio commented Feb 7, 2025

Internal ref pdnsEh-21E-p2

Description

  • Adds an App Clip to the Demo project
  • Wires up code signing for the Debug configuration — More work required for the Release build, given it can only be tested on the App Store account and we don't have it set up yet
  • Updates the Prototype Build automation to strip the App Clip. The Prototype Build is distributed via the Enterprise account but Enterprise apps are not allowed App Clips.

Testing Steps

Checkout this branch and run the debug build on device.

Here's a screenshot from mine:

IMG_6F3CC09BE35F-1

Where to go from here

For @andrewdmontgomery @pinarol & team to

  • Implement the actual App Clip. What's here is just the Xcode template
  • Let me / @Automattic/apps-infrastructure know whether to set up TestFlight distribution to test the App Clip without having to deploy the app on device. That will require a bunch of Fastlane updates, so I didn't go down that path in the context of this PR.

@mokagio mokagio added the demoapp Demo App Changes label Feb 7, 2025
This is only to show a screenshot of the App Clip running on my device that
is obviously the one in this codebase.
I run into an issue testing the prototype build automation and before
trying to debug it, I thought I'd make sure we're on the latest tooling.
For consistency with where the App Clip entitlements file is, that is.
Comment on lines +221 to +248
# rubocop:disable Metrics/AbcSize
# rubocop:disable Metrics/CyclomaticComplexity
def remove_app_clip_dependency!
project_path = XCODEPROJ_PATH
project = Xcodeproj::Project.open(project_path)

native_targets = project.targets.select { |t| t.is_a?(Xcodeproj::Project::Object::PBXNativeTarget) }
app_targets = native_targets.select { |t| t.product_type == 'com.apple.product-type.application' }
app_clip_targets = native_targets.select { |t| t.product_type == 'com.apple.product-type.application.on-demand-install-capable' }

if app_clip_targets.empty?
UI.user_error!("No on-demand-install-capable targets found in #{project_path}. Has something changed in the project structure? Aborting App Clips removal.")
end

app_targets.each do |app|
# Delete any dependency of the app target that is an app_clip target
app.dependencies.delete_if { |dep| app_clip_targets.include?(dep.target) }
# Delete the "Embed App Clips" build phase
app.build_phases.delete_if { |b| b.display_name == 'Embed App Clips' }
end

UI.message('Saving the project file....')
project.save

UI.success('Dependency successfuly removed.')
end
# rubocop:enable Metrics/AbcSize
# rubocop:enable Metrics/CyclomaticComplexity
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is duplicated from Pocket Casts. We might want to centralize at the release toolkit level, see wordpress-mobile/release-toolkit#629

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh right, the original development profile is for an Enterprise app, which doesn't support App Clips. Thanks for this.

Copy link
Contributor

@AliSoftware AliSoftware Feb 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mokagio given that's the second repo/app for which we need to do that trick (removing AppClip for Enterprise / Prototype builds to compile), worth P2-ing about it for future reference?

NVM, I missed your comment above suggesting to centralize this at the release-toolkit level, which would indeed be an even better idea 👍

@wpmobilebot
Copy link

wpmobilebot commented Feb 7, 2025

Gravatar Prototype Build📲 You can test the changes from this Pull Request in Gravatar Prototype Build by scanning the QR code below to install the corresponding build.
App NameGravatar Prototype Build Gravatar Prototype Build
Build Number2119
Version1.0
Bundle IDcom.automattic.gravatar-sdk-demo-uikit.prototype-build
Commitb17a5fd
App Center BuildGravatar SDK Demo - UIKit #603
Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.

@mokagio mokagio marked this pull request as ready for review February 7, 2025 04:12
@mokagio mokagio requested review from andrewdmontgomery, a team and pinarol February 7, 2025 04:12
@pinarol
Copy link
Contributor

pinarol commented Feb 7, 2025

Thank you very much! This is very useful for us. I won't merge it for now as this effort might move to a separate repo.

@pinarol
Copy link
Contributor

pinarol commented Feb 7, 2025

@mokagio The app clip target works fine but this time, I can't get the old demo app target to build in this branch. I get the error: The CFBundleVersion of an App Clip ('1') must match that of its containing parent app ('0').

@pinarol
Copy link
Contributor

pinarol commented Feb 7, 2025

Also, we need to test OAuth in the app clip target so we'll need this config. Does this require updating the provisioning profile also? @mokagio

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>com.apple.developer.associated-domains</key>
	<array>
		<string>appclips:gravatar.com</string>
		<string>applinks:gravatar.com</string>
		<string>webcredentials:gravatar.com</string>
	</array>
	<key>com.apple.developer.parent-application-identifiers</key>
	<array>
		<string>$(AppIdentifierPrefix)com.automattic.gravatar-sdk-demo-uikit</string>
	</array>
</dict>
</plist>

@andrewdmontgomery
Copy link
Contributor

@mokagio The app clip target works fine but this time, I can't get the old demo app target to build in this branch. I get the error: The CFBundleVersion of an App Clip ('1') must match that of its containing parent app ('0').

I fixed this. [5e5a614]

@andrewdmontgomery
Copy link
Contributor

Does this require updating the provisioning profile also?

Ah, yes, I believe it does. Apologies, I didn't consider that when I opened the request. Thanks for catching it.

@andrewdmontgomery
Copy link
Contributor

andrewdmontgomery commented Feb 7, 2025

This happens on a device, when I attempt to install/run the Demo App after having installed/ran the App Clip:

image

Edit: I had more than one previous version of the "Gravatar Demo" apps installed, from back when we had two demo targets (SwiftUI and UIKit). Removed. Problem solved.

@mokagio
Copy link
Contributor Author

mokagio commented Feb 10, 2025

Also, we need to test OAuth in the app clip target so we'll need this config. Does this require updating the provisioning profile also? @mokagio

@pinarol @andrewdmontgomery

51b5a1a addresses this.

The app clip already had the associated domains capability because of the appclips:gravatar.com domain, so no update at the developer portal level was needed.

@dangermattic
Copy link
Collaborator

1 Error
🚫 This PR is tagged with do not merge label(s).

Generated by 🚫 Danger

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
demoapp Demo App Changes do not merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants